Repository navigation
feat(profile): declared-vs-discovered drift (Pillar 4 step 2) - #296
Merged
Merged
Conversation
Adds src/profile/reconcile.ts — the deterministic drift core for the traveling project profile (design: pillar4-traveling-profile-5.0.md §4.3). Split for testability: - computeProfileDrift(declared, actual): PURE set-difference + exact version compare over skills/mcp/workflows/plugins + vault store. Emits removed/added/version-drift/in-sync entries, sorted deterministically (kind, name, status). Version-drift only when BOTH sides pin a differing version (an unpinned declaration matches anything; an unknown found version is never called drift) — no false drift. - discoverActualState(cwd): thin, best-effort fs wiring over discoverAgentToolchain + .kit.toml secrets.store; degrades to unknown (never throws), like the SBOM discovery. Honesty (no false green): a kind the profile declares but whose actual state can't be discovered yet (workflows, plugins — discovery lands in step 4) is reported as UNAUDITED, never folded into 'clean'. Unknown != clean, and unaudited kinds don't count as drift. No CLI, no auto-mutation — reporting only (the kit profile command is step 3). 13 tests. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DbF4MFePXWNCd4dxBQvqH2
|
✅ Docker image built successfully
|
11 tasks done
sandstream
added a commit
that referenced
this pull request
Jul 9, 2026
#297) Wires the profile schema (#295) + drift core (#296) into a CLI verb via COMMAND_REGISTRY (design: pillar4-traveling-profile-5.0.md). Adds src/commands/profile.ts: - show — render the declared profile with per-line reconciliation marks (✓/DRIFT/REMOVED/ ADDED), fingerprint, and an unaudited note for kinds not yet discoverable. - freeze — snapshot the DISCOVERED toolchain (skills/mcp via discoverAgentToolchain, vault store from .kit.toml) into .kit-profile.toml, PRESERVING operator-authored name/workflows/plugins/gates/scope verbatim. Deliberate action, like baseline freeze. - check — report declared-vs-discovered drift; --gate turns any drift into a non-zero exit for CI (default is warn/exit-0). Honest skip (exit 0) when no profile is declared. --json on every subcommand. Zero-LLM, deterministic; never auto-mutates the toolchain. Registry entry (experimental) + SUBCOMMAND_HELP; contracts/public-surface.json regenerated for the new verb. 7 command tests. Claude-Session: https://claude.ai/code/session_01DbF4MFePXWNCd4dxBQvqH2 Co-authored-by: Claude <noreply@anthropic.com>
This was referenced Jul 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Step 2 of the versioned, traveling project profile (Pillar 4). Builds the deterministic drift core on top of the schema landed in #295. The profile declares the intended toolchain; this measures how far the actual project has drifted. Still no CLI and no auto-mutation — reporting only (the
kit profilecommand is step 3). Zero-LLM.Type of Change
Related Issues
kit-research/docs/research/pillar4-traveling-profile-5.0.md§4.3Changes Made
src/profile/reconcile.ts, split for testability:computeProfileDrift(declared, actual)— PURE set-difference + exact version comparison over skills / mcp / workflows / plugins + vault store. Emitsremoved/added/version-drift/in-syncentries, sorted deterministically (kind → name → status). Version-drift only when both sides pin a differing version — an unpinned declaration matches any found version, and an unknown found version is never called drift (no false drift).discoverActualState(cwd)— thin, best-effort fs wiring overdiscoverAgentToolchain+.kit.tomlsecrets.store; degrades to "unknown" instead of throwing, mirroring the SBOM discovery's defensive posture.src/profile/reconcile.test.ts: 13 tests (clean / removed / added / version-drift / unpinned / unknown-found / vault in-sync·drift·not-declared / unaudited / determinism + sort; plusdiscoverActualStateagainst real temp projects and an end-to-end feed intocomputeProfileDrift).Testing
Test Coverage
npm test) — full suite 2633 pass / 0 fail (2620 baseline + 13)Manual Testing
npx tsc --noEmit→ clean.npx eslint src/profile/*.ts→ clean.npm run build && node scripts/test.mjs→ 2633 pass, 0 fail.npx prettier --check src/profile/*.ts→ formatted.Breaking Changes
None / N/A — new module; nothing imports it yet.
Checklist
npm test)Performance Impact
Reviewer Notes
The no-false-green posture is the key design point: a component kind the profile declares but whose actual state can't be discovered yet (workflows, plugins — their discovery lands in step 4) is reported as
unaudited, never folded intocleanand never counted as drift. Unknown ≠ clean and unknown ≠ dirty. This is whyDiscoveredState.workflows/pluginsarenull(unknown) rather than[](empty). Next step (3) wireskit profile show|freeze|checkviaCOMMAND_REGISTRYto render this.🤖 Generated with Claude Code
https://claude.ai/code/session_01DbF4MFePXWNCd4dxBQvqH2
Generated by Claude Code